Skip to content

Level pre-commit's ruff with the one this project declares - #7

Merged
samuelduchesne merged 1 commit into
mainfrom
fix-ruff-s310
Sep 6, 2026
Merged

Level pre-commit's ruff with the one this project declares#7
samuelduchesne merged 1 commit into
mainfrom
fix-ruff-s310

Conversation

@samuelduchesne

Copy link
Copy Markdown
Contributor

make check failed on scripts/sync_js_artifacts.py for S310, on a file nobody had touched.

The cause is not the code. pre-commit pinned ruff v0.14.9 while this project's dev dependency is 0.16.6, so the hook ran a linter two minor versions behind the one uv run ruff runs — and the two disagreed. The flagged line builds its URL from an f-string whose https:// prefix is a literal directly above the call, with only a repo constant and the pinned docs level interpolated after it. The scheme cannot vary. Newer ruff reads that correctly and reports nothing; v0.14.9 could not.

So the fix is the stale pin, not a noqa on correct code.

Why ruff-format is held to Python

Bumping the pin alone reformats 46 published documentation pages. From v0.15 ruff-format also formats Python inside Markdown fences, which collapses the aligned trailing comments the examples use to explain themselves:

-    print(e.exit_code)     # Process exit code, or None for timeout/OS error
-    print(e.stderr)        # Captured stderr (truncated to 500 chars)
+    print(e.exit_code)  # Process exit code, or None for timeout/OS error
+    print(e.stderr)  # Captured stderr (truncated to 500 chars)

and rewraps calls that were wrapped for reading. Whether the site's examples should be machine-formatted is an editorial decision about the documentation. It might well be the right one — but it should be made deliberately, not as a side effect of catching a linter up.

types_or: [python, pyi] holds the hook to exactly what it formatted before, so this change is the S310 fix and nothing else.

Verified

  • uv run pre-commit run --all-files: every hook passes, and the diff is one file.
  • uv run pyright: 22 errors on main and 22 on this branch, identical. Those are pre-existing and separate — mostly BatchResult not being iterable and a save_idf import in the tutorial snippet — and they keep make check red for a reason this PR does not touch and does not claim to fix.

They had drifted two minor versions apart: the hook pinned v0.14.9 while the dev
dependency is 0.16.6. A hook running an older linter than the project's own
reports findings `uv run ruff` does not, and the symptom was `make check` failing
on `scripts/sync_js_artifacts.py`, a file nobody had touched, for S310 on a URL
whose scheme is a literal on the line above the call. Newer ruff reads that
correctly; the older one could not.

`ruff-format` is held to Python. From v0.15 it also formats Python inside
Markdown fences, and letting the bump enable that would rewrite 46 published
pages: it collapses the aligned trailing comments the examples use to explain
themselves and rewraps calls that were wrapped for reading. Whether the site's
examples should be machine-formatted is an editorial decision about the
documentation, and not one a version bump should make on the way past.
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Docs preview for this PR is available at:
https://developers.idfkit.com/pr-preview/pr-7/

github-actions Bot added a commit that referenced this pull request Sep 6, 2026
@samuelduchesne
samuelduchesne merged commit 05f70ca into main Sep 6, 2026
6 checks passed
@samuelduchesne
samuelduchesne deleted the fix-ruff-s310 branch September 6, 2026 22:17
github-actions Bot added a commit that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant